package com.struts.core.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

/**
 * װ
 * @author gzq
 *
 */
public class InstallFormUtil {
	
	@SuppressWarnings("rawtypes")
	public static Object install(Class clazz,HttpServletRequest request){
		Object bean = null;
		try {
			
			bean = (Object)clazz.newInstance();
			Field[] fs = clazz.getDeclaredFields();
			for(Field f:fs){
				f.setAccessible(true);
				f.set(bean, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return bean;
	}

}
